<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta name="description" content="<?php echo ($Config["sitename"]); ?>">
    <meta name="author" content="Jeremy">
    <title>系统后台 - <?php echo ($Config["sitename"]); ?> - by Jeremy</title>
    <link type="text/css" rel="stylesheet" media="screen" href="../statics/common/style/reset.css?v=3.17.2">
    <style type="text/css">
        body{color:#333333;position:relative;background-color:#F9F9F9;font:12px Arial,"Microsoft Yahei","Simsun","Hiragino Sans GB","Lucida Grande","Lucida Sans","Lucida Sans Unicode",Verdana,sans-serif;}
        html,body{line-height:1.6;background-color:#F9F9F9;}
        .clearfix:after{content:"";display:block;height:0;clear:both;visibility:hidden}
        * html .clearfix{zoom:1;}
        *:first-child+ html .clearfix{zoom:1;}

        .box-admin-inner{left:50%;margin-left:-180px;margin-top:80px;position:absolute;width:360px;background:#47546B;color:#FFFFFF;padding:20px;border:5px solid #FFFFFF;border-radius:2px;box-shadow:0 0 2px rgba(0,0,0,0.3);}
        .box-admin-inner .box-tit {border-bottom: 1px solid #56647d;margin-bottom:20px;}
        .box-admin-inner .box-tit h1 {color:#fff;font-size:28px;text-align:center;font-family:'Lucida Sans Unicode', Arial, Helvetica, sans-serif;}
        .box-admin-inner .box-tit h1 em {color:#fb9337;font-weight: normal;}

        .box-admin-inner .box-ftr {color:#979fad;border-top: 1px solid #56647d;margin-top:20px;padding-top: 10px;text-align:right;}
        .box-admin-inner .box-ftr a {color:#979fad;text-decoration:none;font-weight: bold;}

        .form-admin-login dl {padding:10px 0;}
        .form-admin-login dl dt {
            float: left;
            display: inline;
        }
        .form-admin-login dl dt label {
            width: 46px;
            height: 46px;
            background: #EEEEEE;
            border-right: 1px solid #ddd;
            border-radius: 2px 0 0 2px;
            text-indent: -999em;
            display: block;
        }
        .form-admin-login dl dd {overflow: hidden;height:46px;position: relative;}
        .form-admin-login dl dd .img-vcode {cursor:pointer;position: absolute;height:42px;width:120px;right:2px;top:2px;background: #EEEEEEE;}

        .form-admin-login .textfield {
            background: #fcfcfc;
            border: none;
            border-radius: 0 2px 2px 0;
            color: #666;
            height:46px;
            line-height:46px;
            padding: 0 10px;
            vertical-align: middle;
            width: 100%;
            box-sizing: border-box;
            font-size:16px;
        }
        .form-admin-login .textfield:focus {
            background: #ffffff;
        }
        .form-admin-login .btn-submit {
            border: none;
            background: url("statics/admin/images/btngrad.png") repeat-x left top #f0801d;
            border-radius: 2px;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
            font-family: "Microsoft Yahei",Arial,Helvetica,sans-serif;
            font-size: 16px;
            font-weight: normal;
            height:46px;
            line-height: 46px;
            text-align: center;
            text-transform: uppercase;
            box-sizing: border-box;
            color:#FFFFFF;
            cursor: pointer;
            width: 100%;
        }
        .form-admin-login .btn-submit:hover {background-color: #f0721e;}
        .form-admin-login .btn-submit:active {
            -moz-box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
            -webkit-box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
            box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
        }

        .form-admin-login .username dt label {background: url("statics/admin/images/icons/passport/username.png") no-repeat center #EEEEEE;}
        .form-admin-login .password dt label {background: url("statics/admin/images/icons/passport/password.png") no-repeat center #EEEEEE;}
        .form-admin-login .vcode dt label {background: url("statics/admin/images/icons/passport/vcode.png") no-repeat center #EEEEEE;}

        .form-admin-login .txt-vcode {padding-right:130px;}

    </style>
    <script type="text/javascript">
        if (window.parent !== window.self) {
            document.write = '';
            window.parent.location.href = window.self.location.href;
            setTimeout(function () {
                document.body.innerHTML = '';
            }, 0);
        }
    </script>
</head>
<body>
<div class="wrap">
    <div class="box box-admin-inner">
        <div class="box-tit">
            <h1><em>Backend </em> 控制台</h1>
        </div>
        <div class="box-cnt">
            <form id="formAdminLogin" class="form-admin-login" action="" method="post">
                <dl class="clearfix username">
                    <dt><label>管理员账号：</label></dt>
                    <dd><input id="admin_name" name="admin_name" type="text" class="textfield" placeholder="请输入管理员账号"></dd>
                </dl>
                <dl class="clearfix password">
                    <dt><label>管理员账密码：</label></dt>
                    <dd><input id="admin_password" name="admin_password" type="password" class="textfield" placeholder="请输入管理密码"></dd>
                </dl>
                <dl class="clearfix vcode">
                    <dt><label>验证码：</label></dt>
                    <dd>
                        <input id="verifyCode" class="textfield txt-vcode" name="verifyCode" maxlength="4" type="text" value="" placeholder="请输入验证码">
                        <img id="vcode" class="img-vcode" src="">
                    </dd>
                </dl>
                <dl class="clearfix">
                    <dd><button class="button btn-submit" id="loginbtn" type="button">登录</button></dd>
                </dl>
            </form>
        </div>
        <div class="box-ftr">
            <span class="copyright">by <a href="mailto:690591423@qq.com">Steven</a></span>
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/common/script/jquery-1.11.1.min.js?v=1.11.1"></script>
<script src="/static/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var change_vcode = function() {
            var src = "<?php echo u('backend/passport/verifycode');?>&v=";
            $('#vcode').attr('src', src+ Math.random())
            return false;
        };

        $('#vcode').bind('click', change_vcode);

        change_vcode();



        //提交表单
        $('#loginbtn').click(function () {
            var name = $('#admin_name').val();
            var password = $('#admin_password').val();
            var code = $('#verifyCode').val();
            var url = "<?php echo u('backend/passport/login');?>"
            if (name == '')
            {
                $('#admin_name').focus();
                layer.tips('请输入用户名或邮箱', '#admin_name', {
                    tips: [
                        2,
                        '#009f95'
                    ],
                    time: 3000
                });
                return false;
            }
            if (password == '')
            {
                $('#admin_password').focus();
                layer.tips('请输入密码', '#admin_password', {
                    tips: [
                        2,
                        '#009f95'
                    ],
                    time: 3000
                });
                return false;
            }
            if (code == '')
            {
                $('#verifyCode').focus();
                layer.tips('请输入验证码', '#verifyCode', {
                    tips: [
                        1,
                        '#009f95'
                    ],
                    time: 3000
                });
                return false;
            }
            $.post(url, {
                name: name,
                password: password,
                code: code
            }, function (data) {
                if (!data.status)
                {
                    change_vcode();
                    layer.alert(data.msg, {
                        icon: 5
                    })
                } else {
                    layer.msg(data.msg, {
                        time: 2000,
                        icon: 6
                    }, function () {
                        window.location.href = "<?php echo u('backend/index/index');?>"
                    });
                }
            });
        });
    });
</script>
</body>
</html>